<template>
  <div>
    {{ nowdate }}

    <el-table :data="datalist" style="width: 100%">
      <el-table-column prop="date" label="周一">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week1 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week1 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周二">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week2 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week2 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周三">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week3 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week3 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周四">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week4 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week4 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周五">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week5 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week5 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周六">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week6 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week6 }}
        </template>
      </el-table-column>
      <el-table-column prop="date" label="周日">
        <template slot-scope="aa">
          <el-input
            v-show="aa.row.week7 == nowdate"
            style="width: 50%"
          ></el-input>
          <br /><br />
          {{ aa.row.week7 }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { housedatemeony } from "@/api/housestate";
export default {
  name: "VueElementAdminFixInstallProblemAddDateMemory",

  data() {
    return {
      datalist: [],
      nowdate: "",
    };
  },

  mounted() {
    let datenow = new Date();
    let y = datenow.getFullYear();
    let m = datenow.getMonth() + 1;
    let r = datenow.getDate();

    if (m < 10) {
      m = "0" + m;
    }

    if (r < 10) {
      r = "0" + r;
    }

    let d = y + "-" + m + "-" + r;
    this.nowdate = d;

    this.getdate();
  },

  methods: {
    getdate() {
      housedatemeony().then((res) => {
        this.datalist = res.data;
        console.log(this.datalist);
      });
    },
  },
};
</script>